package com.ykdl.member.kid.wxapi;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;

import com.tencent.mm.sdk.modelbase.BaseReq;
import com.tencent.mm.sdk.modelbase.BaseResp;
import com.tencent.mm.sdk.openapi.IWXAPI;
import com.tencent.mm.sdk.openapi.IWXAPIEventHandler;
import com.tencent.mm.sdk.openapi.WXAPIFactory;
import com.umeng.socialize.bean.SHARE_MEDIA;
import com.umeng.socialize.bean.SocializeEntity;
import com.umeng.socialize.controller.UMServiceFactory;
import com.umeng.socialize.controller.UMSocialService;
import com.umeng.socialize.controller.listener.SocializeListeners.SnsPostListener;
import com.umeng.socialize.weixin.view.WXCallbackActivity;
import com.ykdl.member.kid.R;
import com.ykdl.member.kid.util.Constants;

public class WXEntryActivity extends Activity implements IWXAPIEventHandler {   
    private IWXAPI api;   
  
    @Override  
    public void onCreate(Bundle savedInstanceState) {   
        super.onCreate(savedInstanceState);   
        api = WXAPIFactory.createWXAPI(this,   
        		"wx1594ffac39018603", false);   
        api.handleIntent(getIntent(), this);   
  
    }   
    
    @Override
	protected void onNewIntent(Intent intent) {
		super.onNewIntent(intent);
		setIntent(intent);
		api.handleIntent(intent, this);
	}

  
    @Override  
    public void onReq(BaseReq resp) {   
    	   
      }   
  

	@Override
	public void onResp(BaseResp resp) {
		// TODO Auto-generated method stub
		String result = "";   
		  
        switch (resp.errCode) {   
        case BaseResp.ErrCode.ERR_OK:   
            result = "成功";//R.string.errcode_success;   
            break;   
        case BaseResp.ErrCode.ERR_USER_CANCEL:   
            result = "取消";//R.string.errcode_cancel;   
            break;   
        case BaseResp.ErrCode.ERR_AUTH_DENIED:   
            result = "被拒绝";//R.string.errcode_deny;   
            break;   
        default:   
            result = "返回";//R.string.errcode_unknown;   
           break;   
       }   
  
        Toast.makeText(this, result, Toast.LENGTH_LONG).show();  
 
        // TODO 微信分享 成功之后调用接口   
        this.finish();    
	}   
  
}  

